package view;

import java.awt.BorderLayout;
import java.io.File;
import java.io.IOException;
import java.util.ResourceBundle;
import java.util.Scanner;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;

/**
 * 
 * @author Andrea Scripa
 * 
 */
//WHY WONT THIS WORK????
public class About {
	ResourceBundle myViewLabels = ResourceBundle
			.getBundle("resources.englishView");
	ResourceBundle myAboutInfo = ResourceBundle
			.getBundle("resources.slogoMultimedia");
	private String message = "";

	public void execute() {
		JFrame aboutFrame = new JFrame(myViewLabels.getString("AboutBoxHeader"));
		aboutFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		JPanel holdText = new JPanel(new BorderLayout());
		JTextArea aboutMessageField = new JTextArea();
		aboutMessageField.setBorder(BorderFactory.createEtchedBorder());
		aboutMessageField.setLineWrap(true);
		aboutMessageField.setWrapStyleWord(true);
		aboutMessageField.setEditable(false);

		File aboutMessageFile = new File(myAboutInfo
				.getString("AboutMessageFile"));

		try {
			Scanner in = new Scanner(aboutMessageFile);
			while (in.hasNext()) {
				message += in.next();
				message += " ";
			}
			message.trim();
			aboutMessageField.setText(message);
		} catch (IOException e) {
			System.out.println("error!");
		}

		holdText.add(aboutMessageField, BorderLayout.CENTER);
		aboutFrame.add(holdText, BorderLayout.CENTER);
		aboutFrame.pack();
		aboutFrame.setVisible(true);
	}

}
